package cn.javadog.algorithm.e1_100;

/**
 * 删除排序数组中的重复项
 * https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
 * @author Sprite
 */
public class Algorithm26 {
	public static void main(String[] args) {
	}


	public int removeDuplicates(int[] nums) {
		if (nums.length == 0) return 0;
		int x = 0;
		for (int i = 0; i < nums.length; i++) {
			if (nums[x] != nums[i]){
				x++;
				nums[x] = nums[i];
			}
		}

		return x+1;
	}
}
